package com.example.weixin02

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.Fragment

class Bottom :Fragment(), View.OnClickListener {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.bottom_fragement, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        view.findViewById<Button>(R.id.btn_p01).setOnClickListener(this)
        view.findViewById<Button>(R.id.btn_p02).setOnClickListener(this)
        view.findViewById<Button>(R.id.btn_p03).setOnClickListener(this)
        view.findViewById<Button>(R.id.btn_p04).setOnClickListener(this)



    }


    override fun onClick(v: View?) {

        val act =  requireActivity() as MainActivity

        if (v != null) {
            when(v.id){
                R.id.btn_p01->{
                    act.showF01()
                }
                R.id.btn_p02->{
                    act.showF02()
                }
                R.id.btn_p03->{
                    act.showF03()
                }
                R.id.btn_p04->{
                    act.showF04()
                }
            }
        }


    }
}